package com.xzjt.web.controller;


import com.xzjt.common.utils.R;
import com.xzjt.web.entity.SysDept;
import com.xzjt.web.service.SysDeptService;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 部门表 前端控制器
 * @RequiresAuthentication说明需要登录之后才能访问的接口
 * </p>
 *
 * @author yuandong
 * @since 2021-11-06
 */
@RestController
@RequestMapping("/dept")
public class SysDeptController {

    @Autowired
    private SysDeptService deptService;

    /**
     * 获取部门下拉树列表
     */
    @RequiresAuthentication
    @GetMapping("/treeselect")
    public R treeselect(SysDept dept){

        List<SysDept> depts = deptService.selectDeptList(dept);
        return R.ok(deptService.buildDeptTreeSelect(depts));
    }

}
